/*************************************************************
 * File: CustomerResource.java
 * Copyright (c) 2012
 * Author: Huang Shaobin
 * Email: Shaobin.Software@gmail.com Shaobin_Software@163.com 
 * Date: Feb 15, 2013
 * Description: 
 ************************************************************/

package snow.biz.selling.web.resource;

import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import snow.biz.selling.service.ICustomerService;
import snow.biz.selling.web.SellingWebConstants;
import snow.core.security.Operation;
import snow.core.security.OperationType;
import snow.core.security.Resource;
import snow.core.web.restlet.ResourceSupport;

/**
 * 客户管理
 * 
 * @author Shaobin.Software@gmail.com Shaobin_Software@163.com
 * @version 1.0
 */
@Path(SellingWebConstants.PATH_CUSTOMERS)
@Resource(uri = SellingWebConstants.RESOURCE_CUSTOMERS, name = "客户管理", desc = "客户管理")
public class CustomerResource extends ResourceSupport {

	private ICustomerService customerService;

	/**
	 * 创建客户
	 * 
	 * @return
	 */
	@POST
	@Operation(OperationType.CREATE)
	@Produces(MediaType.APPLICATION_JSON)
	public Object addCustomer() {
		return getSuccessResult();
	}

	/**
	 * 删除客户
	 * 
	 * @param id
	 * @return
	 */
	@DELETE
	@Path("/{id:\\d+}")
	@Operation(OperationType.REMOVE)
	@Produces(MediaType.APPLICATION_JSON)
	public Object delCustomer(@PathParam("id")
	Integer id) {
		return getSuccessResult();
	}

	public ICustomerService getCustomerService() {
		return this.customerService;
	}

	/**
	 * 查询客户信息
	 * 
	 * @return
	 */
	@GET
	@Operation(OperationType.SEARCH)
	@Produces(MediaType.APPLICATION_JSON)
	public Object listCustomers() {

		return null;
	}

	@PUT
	@Path("/{id:\\d+}")
	@Operation(OperationType.MODIFY)
	@Produces(MediaType.APPLICATION_JSON)
	public Object modCustomer(@PathParam("id")
	Integer id) {
		return getSuccessResult();
	}

	public void setCustomerService(ICustomerService customerService) {
		this.customerService = customerService;
	}

	@GET
	@Path("/{id:\\d+}")
	@Operation(OperationType.SEARCH)
	@Produces(MediaType.APPLICATION_JSON)
	public Object showCustomer(@PathParam("id")
	Integer id) {
		return null;
	}

}
